package com.lhnstart.learn.bases.onedimensional;

import java.util.Scanner;
import java.util.concurrent.ThreadLocalRandom;

/**
 * 数组减少
 *
 * @author lhn
 * @date 2022/10/30 20:47
 * @since 1.0.0
 **/
public class ArrayReduce {

    public static void main(String[] args) {
        int[][] input = new int[2][2];
        for (int i = 0; i < input.length; i++) {
            for (int j = 0; j < input[i].length; j++) {
                input[i][j] = ThreadLocalRandom.current().nextInt(4, 77);
            }
        }

        int[] copyArray = input[1];
        for (int i = 0; i < copyArray.length; i++) {
            System.out.println(copyArray[i]);
        }
    }

    private static void tttetstt() {
        int[] array = {11, 22, 33, 44, 55};
        Scanner scanner = new Scanner(System.in);
        do {
            System.out.println("继续删减：Y ，退出 N");
            char charAt = scanner.next().charAt(0);
            if (charAt == 'N') {
                System.out.println("退出输入！！！");
                break;
            }
            if (array.length == 1) {
                System.out.println("只剩下一个元素，不能再进行删减！");
                break;
            }
            int[] reduceArray = new int[array.length - 1];

            for (int i = 0; i < reduceArray.length; i++) {
                reduceArray[i] = array[i];
            }

            array = reduceArray;
            // 删减后的元素
            for (int i = 0; i < array.length; i++) {
                System.out.println(array[i]);
            }
        } while (true);
    }

}